import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'

Vue.use(VueRouter)

const createRouter = () => new VueRouter({
  mode: 'history', 
  scrollBehavior: () => ({ y: 0 }),
  routes: routes
})

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher 
}

const router = createRouter()

export default router